Skip to content

fix(html): treat og:audio:url and og:video:url as asset sources - #24237

Closed
shreyanshj10 wants to merge 1 commit into
vitejs:mainfrom
shreyanshj10:fix/og-media-url-asset-sources
Closed

shreyanshj10 wants to merge 1 commit into
vitejs:mainfrom
shreyanshj10:fix/og-media-url-asset-sources

Conversation

@shreyanshj10

Copy link
Copy Markdown

assetSource.ts treats og:image:url as an asset URL but not og:audio:url or og:video:url, while accepting secure_url for all three. So of the two tags below, the og:image:url one gets its relative path rewritten in a build and the og:video:url one does not — the output ships a meta tag pointing at a path that is not there.

<meta property="og:image:url" content="./card.png" />
<meta property="og:video:url" content="./clip.mp4" />

To be straight about the spec: ogp.me does not enumerate og:video:url or og:audio:url. It gives them only by reference — "the og:video tag has the identical tags as og:image", and og:audio has "the first 3" of that list, whose first three are url, secure_url and type. So the current list looks like it tracks the names ogp.me prints literally, which is a coherent rule, and og:image:url is in it because the image section spells that one out.

I think the better rule is the one applied in #11138 — whether the content is guaranteed to be a URL. These two are URL-valued under any reading: og:image:url is documented as "Identical to og:image", so by that same reference og:video:url is identical to og:video, which the list already takes and which ogp.me describes as "A URL to a video file that complements this object". So this adds the two names, a test.each over all six og:*:url / og:*:secure_url variants so the three media types stay in step if the list changes again, and the matching line in docs/guide/features.md, which spells the list out. I left og:image:alt, og:video:width and friends alone, since those are not URLs.

This is a behaviour change with no issue behind it, so it is your call: if you would rather the list only carry property names the spec names literally, say so and I am happy to drop it.

I used an AI assistant on this. I wrote the test first and watched it fail on exactly og:audio:url and og:video:url while og:image:url and the three secure_url variants passed, which is what convinced me the gap was real and the test was not passing for the wrong reason. I also read ogp.me myself instead of trusting the assistant's summary of it.

@github-actions github-actions Bot added the bot: likely Likely a bot, LLM, or agent. Automatically comments and closes the issue or PR label Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically flagged as likely to be created by a bot, LLM, or agent, and will be automatically closed. These contributions harm the maintenance of the project. Please read our AI policy for more information.

If you believe this is a mistake, please reply to this comment and we will review it.

@github-actions github-actions Bot closed this Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot: likely Likely a bot, LLM, or agent. Automatically comments and closes the issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant